.class public Lorg/microemu/cldc/http/Connection;
.super Ljava/lang/Object;
.source "Connection.java"

# interfaces
.implements Ljavax/microedition/io/HttpConnection;
.implements Lorg/microemu/microedition/io/ConnectionImplementation;


# static fields
.field protected static allowNetworkConnection:Z


# instance fields
.field protected cn:Ljava/net/URLConnection;

.field protected connected:Z


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 47
    const/4 v0, 0x1

    sput-boolean v0, Lorg/microemu/cldc/http/Connection;->allowNetworkConnection:Z

    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 41
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 45
    const/4 v0, 0x0

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    return-void
.end method

.method public static isAllowNetworkConnection()Z
    .locals 1

    .prologue
    .line 361
    sget-boolean v0, Lorg/microemu/cldc/http/Connection;->allowNetworkConnection:Z

    return v0
.end method

.method public static setAllowNetworkConnection(Z)V
    .locals 0
    .parameter "allowNetworkConnection"

    .prologue
    .line 365
    sput-boolean p0, Lorg/microemu/cldc/http/Connection;->allowNetworkConnection:Z

    .line 366
    return-void
.end method


# virtual methods
.method public close()V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 70
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 79
    :goto_0
    return-void

    .line 74
    :cond_0
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    instance-of v0, v0, Ljava/net/HttpURLConnection;

    if-eqz v0, :cond_1

    .line 75
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    check-cast v0, Ljava/net/HttpURLConnection;

    invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V

    .line 78
    :cond_1
    const/4 v0, 0x0

    iput-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    goto :goto_0
.end method

.method public getDate()J
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 225
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 226
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 228
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 229
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 230
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 233
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getDate()J

    move-result-wide v0

    return-wide v0
.end method

.method public getEncoding()Ljava/lang/String;
    .locals 2

    .prologue
    .line 346
    :try_start_0
    const-string v1, "content-encoding"

    invoke-virtual {p0, v1}, Lorg/microemu/cldc/http/Connection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 348
    :goto_0
    return-object v1

    .line 347
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 348
    .local v0, ex:Ljava/io/IOException;
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getExpiration()J
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 213
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 214
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 216
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 217
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 218
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 221
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getExpiration()J

    move-result-wide v0

    return-wide v0
.end method

.method public getFile()Ljava/lang/String;
    .locals 1

    .prologue
    .line 102
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 103
    const/4 v0, 0x0

    .line 106
    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getURL()Ljava/net/URL;

    move-result-object v0

    invoke-virtual {v0}, Ljava/net/URL;->getFile()Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public getHeaderField(I)Ljava/lang/String;
    .locals 1
    .parameter "n"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 285
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 286
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 288
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 289
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 290
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 293
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0, p1}, Ljava/net/URLConnection;->getHeaderField(I)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getHeaderField(Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .parameter "name"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 249
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 250
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 252
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 253
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 254
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 257
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0, p1}, Ljava/net/URLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getHeaderFieldDate(Ljava/lang/String;J)J
    .locals 2
    .parameter "name"
    .parameter "def"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 273
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 274
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 276
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 277
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 278
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 281
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0, p1, p2, p3}, Ljava/net/URLConnection;->getHeaderFieldDate(Ljava/lang/String;J)J

    move-result-wide v0

    return-wide v0
.end method

.method public getHeaderFieldInt(Ljava/lang/String;I)I
    .locals 1
    .parameter "name"
    .parameter "def"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 261
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 262
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 264
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 265
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 266
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 269
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0, p1, p2}, Ljava/net/URLConnection;->getHeaderFieldInt(Ljava/lang/String;I)I

    move-result v0

    return v0
.end method

.method public getHeaderFieldKey(I)Ljava/lang/String;
    .locals 1
    .parameter "n"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 297
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 298
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 300
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 301
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 302
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 305
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0, p1}, Ljava/net/URLConnection;->getHeaderFieldKey(I)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getHost()Ljava/lang/String;
    .locals 1

    .prologue
    .line 94
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 95
    const/4 v0, 0x0

    .line 98
    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getURL()Ljava/net/URL;

    move-result-object v0

    invoke-virtual {v0}, Ljava/net/URL;->getHost()Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public getLastModified()J
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 237
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 238
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 240
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 241
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 242
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 245
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getLastModified()J

    move-result-wide v0

    return-wide v0
.end method

.method public getLength()J
    .locals 3

    .prologue
    .line 354
    :try_start_0
    const-string v1, "content-length"

    const/4 v2, -0x1

    invoke-virtual {p0, v1, v2}, Lorg/microemu/cldc/http/Connection;->getHeaderFieldInt(Ljava/lang/String;I)I
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    int-to-long v1, v1

    .line 356
    :goto_0
    return-wide v1

    .line 355
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 356
    .local v0, ex:Ljava/io/IOException;
    const-wide/16 v1, -0x1

    goto :goto_0
.end method

.method public getPort()I
    .locals 3

    .prologue
    const/4 v2, -0x1

    .line 127
    iget-object v1, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v1, :cond_0

    move v1, v2

    .line 135
    :goto_0
    return v1

    .line 131
    :cond_0
    iget-object v1, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v1}, Ljava/net/URLConnection;->getURL()Ljava/net/URL;

    move-result-object v1

    invoke-virtual {v1}, Ljava/net/URL;->getPort()I

    move-result v0

    .line 132
    .local v0, port:I
    if-ne v0, v2, :cond_1

    .line 133
    const/16 v1, 0x50

    goto :goto_0

    :cond_1
    move v1, v0

    .line 135
    goto :goto_0
.end method

.method public getProtocol()Ljava/lang/String;
    .locals 1

    .prologue
    .line 90
    const-string v0, "http"

    return-object v0
.end method

.method public getQuery()Ljava/lang/String;
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 118
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    move-object v0, v1

    .line 123
    :goto_0
    return-object v0

    :cond_0
    move-object v0, v1

    goto :goto_0
.end method

.method public getRef()Ljava/lang/String;
    .locals 1

    .prologue
    .line 110
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 111
    const/4 v0, 0x0

    .line 114
    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getURL()Ljava/net/URL;

    move-result-object v0

    invoke-virtual {v0}, Ljava/net/URL;->getRef()Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public getRequestMethod()Ljava/lang/String;
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 139
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    move-object v0, v1

    .line 146
    .end local p0
    :goto_0
    return-object v0

    .line 143
    .restart local p0
    :cond_0
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    instance-of v0, v0, Ljava/net/HttpURLConnection;

    if-eqz v0, :cond_1

    .line 144
    iget-object p0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    .end local p0
    check-cast p0, Ljava/net/HttpURLConnection;

    invoke-virtual {p0}, Ljava/net/HttpURLConnection;->getRequestMethod()Ljava/lang/String;

    move-result-object v0

    goto :goto_0

    .restart local p0
    :cond_1
    move-object v0, v1

    .line 146
    goto :goto_0
.end method

.method public getRequestProperty(Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .parameter "key"

    .prologue
    .line 165
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 166
    const/4 v0, 0x0

    .line 169
    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0, p1}, Ljava/net/URLConnection;->getRequestProperty(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public getResponseCode()I
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 181
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 182
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 184
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 185
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 186
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 189
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    instance-of v0, v0, Ljava/net/HttpURLConnection;

    if-eqz v0, :cond_2

    .line 190
    iget-object p0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    .end local p0
    check-cast p0, Ljava/net/HttpURLConnection;

    invoke-virtual {p0}, Ljava/net/HttpURLConnection;->getResponseCode()I

    move-result v0

    .line 192
    :goto_0
    return v0

    .restart local p0
    :cond_2
    const/4 v0, -0x1

    goto :goto_0
.end method

.method public getResponseMessage()Ljava/lang/String;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 197
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 198
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 200
    :cond_0
    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-nez v0, :cond_1

    .line 201
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V

    .line 202
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 205
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    instance-of v0, v0, Ljava/net/HttpURLConnection;

    if-eqz v0, :cond_2

    .line 206
    iget-object p0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    .end local p0
    check-cast p0, Ljava/net/HttpURLConnection;

    invoke-virtual {p0}, Ljava/net/HttpURLConnection;->getResponseMessage()Ljava/lang/String;

    move-result-object v0

    .line 208
    :goto_0
    return-object v0

    .restart local p0
    :cond_2
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public getType()Ljava/lang/String;
    .locals 2

    .prologue
    .line 338
    :try_start_0
    const-string v1, "content-type"

    invoke-virtual {p0, v1}, Lorg/microemu/cldc/http/Connection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 340
    :goto_0
    return-object v1

    .line 339
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 340
    .local v0, ex:Ljava/io/IOException;
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getURL()Ljava/lang/String;
    .locals 1

    .prologue
    .line 82
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 83
    const/4 v0, 0x0

    .line 86
    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getURL()Ljava/net/URL;

    move-result-object v0

    invoke-virtual {v0}, Ljava/net/URL;->toString()Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public openConnection(Ljava/lang/String;IZ)Ljavax/microedition/io/Connection;
    .locals 4
    .parameter "name"
    .parameter "mode"
    .parameter "timeouts"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 50
    invoke-static {}, Lorg/microemu/cldc/http/Connection;->isAllowNetworkConnection()Z

    move-result v2

    if-nez v2, :cond_0

    .line 51
    new-instance v2, Ljava/io/IOException;

    const-string v3, "No network"

    invoke-direct {v2, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v2

    .line 55
    :cond_0
    :try_start_0
    new-instance v1, Ljava/net/URL;

    invoke-direct {v1, p1}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/net/MalformedURLException; {:try_start_0 .. :try_end_0} :catch_0

    .line 59
    .local v1, url:Ljava/net/URL;
    invoke-virtual {v1}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v2

    iput-object v2, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    .line 60
    iget-object v2, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    const/4 v3, 0x1

    invoke-virtual {v2, v3}, Ljava/net/URLConnection;->setDoOutput(Z)V

    .line 63
    iget-object v2, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    instance-of v2, v2, Ljava/net/HttpURLConnection;

    if-eqz v2, :cond_1

    .line 64
    iget-object v2, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    check-cast v2, Ljava/net/HttpURLConnection;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Ljava/net/HttpURLConnection;->setInstanceFollowRedirects(Z)V

    .line 66
    :cond_1
    return-object p0

    .line 56
    .end local v1           #url:Ljava/net/URL;
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 57
    .local v0, ex:Ljava/net/MalformedURLException;
    new-instance v2, Ljava/io/IOException;

    invoke-virtual {v0}, Ljava/net/MalformedURLException;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v2
.end method

.method public openDataInputStream()Ljava/io/DataInputStream;
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 319
    new-instance v0, Ljava/io/DataInputStream;

    invoke-virtual {p0}, Lorg/microemu/cldc/http/Connection;->openInputStream()Ljava/io/InputStream;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/DataInputStream;-><init>(Ljava/io/InputStream;)V

    return-object v0
.end method

.method public openDataOutputStream()Ljava/io/DataOutputStream;
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 333
    new-instance v0, Ljava/io/DataOutputStream;

    invoke-virtual {p0}, Lorg/microemu/cldc/http/Connection;->openOutputStream()Ljava/io/OutputStream;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/DataOutputStream;-><init>(Ljava/io/OutputStream;)V

    return-object v0
.end method

.method public openInputStream()Ljava/io/InputStream;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 309
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 310
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 313
    :cond_0
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 315
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v0

    return-object v0
.end method

.method public openOutputStream()Ljava/io/OutputStream;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 323
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 324
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 327
    :cond_0
    const/4 v0, 0x1

    iput-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    .line 329
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0}, Ljava/net/URLConnection;->getOutputStream()Ljava/io/OutputStream;

    move-result-object v0

    return-object v0
.end method

.method public setRequestMethod(Ljava/lang/String;)V
    .locals 2
    .parameter "method"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 151
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-nez v0, :cond_0

    .line 152
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 155
    :cond_0
    const-string v0, "POST"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 156
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Ljava/net/URLConnection;->setDoOutput(Z)V

    .line 159
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    instance-of v0, v0, Ljava/net/HttpURLConnection;

    if-eqz v0, :cond_2

    .line 160
    iget-object p0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    .end local p0
    check-cast p0, Ljava/net/HttpURLConnection;

    invoke-virtual {p0, p1}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V

    .line 162
    :cond_2
    return-void
.end method

.method public setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
    .locals 1
    .parameter "key"
    .parameter "value"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 173
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    if-eqz v0, :cond_0

    iget-boolean v0, p0, Lorg/microemu/cldc/http/Connection;->connected:Z

    if-eqz v0, :cond_1

    .line 174
    :cond_0
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0

    .line 177
    :cond_1
    iget-object v0, p0, Lorg/microemu/cldc/http/Connection;->cn:Ljava/net/URLConnection;

    invoke-virtual {v0, p1, p2}, Ljava/net/URLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 178
    return-void
.end method
